from aip import AipOcr
import os

""" 读取文件 """
def get_file_content(filePath):
   with open(filePath, "rb") as fp:
      return fp.read()

""" 你的 APPID AK SK """
APP_ID = os.environ['APP_ID']
API_KEY = os.environ['API_KEY']
SECRET_KEY = os.environ['SECRET_KEY']


print(APP_ID)
print(API_KEY)
print(SECRET_KEY)

client = AipOcr(APP_ID, API_KEY, SECRET_KEY)
print('client', client)

image = get_file_content('/home/linus/图片/test2.jpg')

# 调用通用文字识别（标准版）
#res_image = client.basicGeneral(image)
#print(res_image)

# 如果有可选参数
options = {}
options["language_type"] = "CHN_ENG"
options["detect_direction"] = "false"
options["detect_language"] = "false"
options["probability"] = "false"
res_image = client.basicGeneral(image, options)
print(res_image)
